package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;
//model layer package has to be imported
/**
 * Controller class for Rent
 * 
 * @author (Gruppe C) 
 * @version (2005.03.31)
 * @revised version English (Ab)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class RentCtr
{
    //declare instance variables to reference containers
    //passed as arguments from the main class
    private RentContainer rentListing;
   

    /**
     * Constructor for objects of class RentCtr
     */
    public RentCtr()//DVD container is to be passed as parameter from the main controller
    {
        //set up references to containers    
        rentListing = new RentContainer();
    }
    
    
    public Rent findRent(long id)
    {
        return rentListing.findRent(id);
    }
    

    public void addRent(int id, String rentDate, double rentPeriod)
    {       
          rentListing.rents.add(new Rent(id, rentDate, rentPeriod));
    }
    
    public void deleteRent(long id)
    {
       Rent rent = findRent(id);
       if(rent !=null)
       rentListing.deleteRent(id);
    }
       
    public void addCopy(long id)
       {
           //create a copy of the specified dvd and add it to the dvd
       }
    
   public ArrayList<Rent> rentsNo()
       {
           return rentListing.rentList();
       }
    
   public ArrayList listAllRents()
       {
           return null;
       }
    
}
